module Page3.Model exposing (..)
import Json.Decode as D

type alias Page =
  { title: String
  , sub_title: String
  , items: List Item }


type alias Item =
  { title: String
  , content: String }


decoder: D.Decoder Page
decoder = 
  D.map3 Page
    (D.field "title" D.string)
    (D.field "sub_title" D.string)
    (D.field "items" (D.list item_decoder))


item_decoder: D.Decoder Item
item_decoder =
  D.map2 Item
    (D.field "title" D.string)
    (D.field "content" D.string)